<?php

namespace app\model\training;

use app\BaseModel;
use app\model\UserModel;
use think\model\relation\BelongsTo;

/**
 * 培训讲座-教材
 */
class TrainingTextbookModel extends BaseModel
{
    protected $name = 'training_textbook';

    /**
     * 用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind([
            'user_name' => 'name'
        ]);
    }

    /**
     * 教材类型
     * @return BelongsTo
     */
    public function textbookType(): BelongsTo
    {
        return $this->belongsTo(TrainingTextbookTypeModel::class,'type_id')->bind([
            'textbook_type_name' => 'name'
        ]);
    }
}